import Vue from "vue";
import VueRouter from "vue-router";
import index from "../views/index.vue";
import store from '../store/index'

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    component: index,
    meta: { title: '商贸部', isleft: true, },
  },
  // {
  //   path: "/login",
  //   meta: { title: '登录页面', isleft: true, istab: true, istabbottom: true },
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/login.vue"),
  // },
  // {
  //   path: "/user",
  //   meta: { title: '用户中心', isleft: true, istab: true },
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/user.vue"),
  // },
  // {
  //   path: "/coins",
  //   meta: { title: 'Coins', isleft: true, },
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/coins.vue"),
  // },
  // {
  //   path: "/store",
  //   meta: { title: 'Store', isleft: true, },
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/store.vue"),
  // },
  // {
  //   path: "/Chapter",
  //   meta: { title: 'Store', isleft: true, istab: true, istabbottom: true },
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/Chapter.vue"),
  // },
  // {
  //   path: "/coute",
  //   meta: { title: 'Store', isleft: true, istab: true, istabbottom: true },
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/coute.vue"),
  // },

];

const router = new VueRouter({
  routes,
});

router.beforeEach((to, form, next) => {
  store.commit('CHONG_TITLE', to.meta.title || '学校官网')
  store.commit('CHONG_ISLEFT', !!to.meta.isleft)
  store.commit('CHONG_ISTAB', !to.meta.istab)
  store.commit('CHONG_ISTABBOTTOM', !to.meta.istabbottom)
  next()
})

export default router;
